% TEST_ID: LANG-EXPAND-0047
% CATEGORY: language/struct
% 测试结构体数组的行为

function test_struct_array
    A.field1 = 1;
    A.field2 = 2;
    assert(isequal(A.field1, 1)); % Initial field value
    assert(isequal(A.field2, 2)); % Initial field value
    A(2) = struct('field3', 3); % Create a struct array

    assert(isequal(A(1).field1, 1)); % Check first element field1
    assert(isequal(A(1).field2, 2)); % Check first element field2
    assert(isequal(A(2).field3, 3)); % Check

    assert(isequal(numel(A), 2)); % Check number of elements in struct array
    assert(isequal(size(A), [1 2])); % Check size of struct
    assert(isequal(fieldnames(A), {'field1'; 'field2'; 'field3'})); % Check field names



end

